/**
 * Copyright 2011 Honeywell Federal Manufacturing & Technologies, LLC. This material was produced under U.S. Government
 * contract DE-ACO4-01AL66850, Honeywell Federal Manufacturing & Technologies, LLC, (FM&T) with the U. S. Department of
 * Energy for the operation of the Kansas City Plant . The U.S. Government has rights to use, reproduce, and distribute
 * this software.  NEITHER THE GOVERNMENT NOR Honeywell Federal Manufacturing & Technologies, LLC, MAKES ANY WARRANTY,
 * EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.  If software is modified to produce
 * derivative works, such modified software should be clearly marked, so as not to confuse it with the version available
 * from FM&T.
 *
 * Additionally, this program is free software; you can redistribute it and/or modify it under the terms of the GNU
 * General Public License Version 3 published by the Free Software Foundation. Accordingly, this program is distributed in
 * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this library.
 * If not, see http://www.gnu.org/licenses/.
 */
package org.braintrain.domain;

import com.kcp.ko.fmtnmlib.types.Copyable;
import org.braintrain.domain.types.NavigationType;
import org.braintrain.services.util.contentBaseVisitor.ContentBaseVisitor;

import javax.persistence.*;

/**
 * This is the base type for the Navigation "Released" and "Delta" content
 * links.  It uses the "JOINED" inheritance strategy so that ContentBase
 * as well as all of its base types are stored in different tables.  This
 * can be a little cumbersome, and requires the use of the visitor (ContentBaseVisitor)
 * to easily resolve the base type.
 * 
 * @author John Ericksen
 *
 */

@Entity
@Table( name="braintrain_content_base" )
@Inheritance( strategy=InheritanceType.JOINED )
public abstract class ContentBase extends BrainTrainBase implements Copyable<ContentBase>{

    private static final long serialVersionUID = -5978062530020974034L;
    
    private String name;
   
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    @Transient
    public abstract NavigationType getType();
  
    public ContentBase copy(ContentBase copy) {
        
        copy.setName(this.getName());
        
        return copy;
    }

    public abstract void accept(ContentBaseVisitor visitor);
   
}
